home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr40 / x1j4_src.zip / ICMP.H < prev    next >
Text File  |  1995-01-20  |  5KB  |  130 lines

  1. /*****************************************************************************/
  2. /*                                              */
  3. /*                                         */
  4. /*    *****              *****                      */
  5. /*     *****            *****                         */
  6. /*       *****          *****                         */
  7. /*         *****        *****                         */
  8. /*  ***************      ***************                     */
  9. /*  *****************    *****************                     */
  10. /*  ***************      ***************                     */
  11. /*         *****        *****       TheNet                    */
  12. /*       *****          *****       Portable. Compatible.         */
  13. /*     *****            *****       Public Domain             */
  14. /*    *****              *****    G8KBB                  */
  15. /*                                         */
  16. /* This software is public domain ONLY for non commercial use                */
  17. /*                                                                           */
  18. /*                                         */
  19. /*****************************************************************************/
  20.  
  21. /* Level 3, Internet Gateway icmp header file                     */
  22. /* Version 1.00                                                              */
  23. /* Dave Roberts G8KBB, 7, Rowanhayes Close, Ipswich, England             */
  24. /* 10-April-91                                     */
  25. /* This software is released into the public domain on the understanding
  26.  * that it is to be used only for non life threatening, amateur, non 
  27.  * commercial purposes only. 
  28.  * It has been written expressly for use in self tuition of
  29.  * people in amateur radio communications only. It is NOT claimed that this
  30.  * software works correctly. 
  31.  *
  32.  *
  33.  * Released as TheNet X-1J, September 1993
  34.  *
  35.  * Released as TheNet X-1J release 4, January 1995
  36.  */
  37.  
  38. /* SNMP MIB variables, used for statistics and control. See RFC 1066 */
  39. #define    icmpInMsgs        Icmp_mib[1].value.integer
  40. #define    icmpInErrors        Icmp_mib[2].value.integer
  41. #define icmpInDestUnreachs    Icmp_mib[3].value.integer
  42. #define icmpInTimeExcds        Icmp_mib[4].value.integer
  43. #define icmpInParmProbs        Icmp_mib[5].value.integer
  44. #define icmpInSrcQuenchs    Icmp_mib[6].value.integer
  45. #define icmpInRedirects        Icmp_mib[7].value.integer
  46. #define icmpInEchos        Icmp_mib[8].value.integer
  47. #define icmpInEchoReps        Icmp_mib[9].value.integer
  48. #define icmpInTimestamps    Icmp_mib[10].value.integer
  49. #define icmpInTimestampReps    Icmp_mib[11].value.integer
  50. #define icmpInAddrMasks        Icmp_mib[12].value.integer
  51. #define icmpInAddrMaskReps    Icmp_mib[13].value.integer
  52. #define icmpOutMsgs        Icmp_mib[14].value.integer
  53. #define icmpOutErrors        Icmp_mib[15].value.integer
  54. #define icmpOutDestUnreachs    Icmp_mib[16].value.integer
  55. #define icmpOutTimeExcds    Icmp_mib[17].value.integer
  56. #define icmpOutParmProbs    Icmp_mib[18].value.integer
  57. #define icmpOutSrcQuenchs    Icmp_mib[19].value.integer
  58. #define icmpOutRedirects    Icmp_mib[20].value.integer
  59. #define icmpOutEchos        Icmp_mib[21].value.integer
  60. #define icmpOutEchoReps        Icmp_mib[22].value.integer
  61. #define icmpOutTimestamps    Icmp_mib[23].value.integer
  62. #define icmpOutTimestampReps    Icmp_mib[24].value.integer
  63. #define icmpOutAddrMasks    Icmp_mib[25].value.integer
  64. #define icmpOutAddrMaskReps    Icmp_mib[26].value.integer
  65. #define    NUMICMPMIB    26
  66.  
  67. /* Internet Control Message Protocol */
  68.  
  69. /* Message types */
  70. #define    ICMP_ECHO_REPLY        0    /* Echo Reply */
  71. #define    ICMP_DEST_UNREACH    3    /* Destination Unreachable */
  72. #define    ICMP_QUENCH        4    /* Source Quench */
  73. #define    ICMP_REDIRECT        5    /* Redirect */
  74. #define    ICMP_ECHO        8    /* Echo Request */
  75. #define    ICMP_TIME_EXCEED    11    /* Time-to-live Exceeded */
  76. #define    ICMP_PARAM_PROB        12    /* Parameter Problem */
  77. #define    ICMP_TIMESTAMP        13    /* Timestamp */
  78. #define    ICMP_TIME_REPLY        14    /* Timestamp Reply */
  79. #define    ICMP_INFO_RQST        15    /* Information Request */
  80. #define    ICMP_INFO_REPLY        16    /* Information Reply */
  81. #define    ICMP_ADDR_MASK        17    /* Address mask request */
  82. #define    ICMP_ADDR_MASK_REPLY    18    /* Address mask reply */
  83. #define    ICMP_TYPES        19
  84.  
  85. /* Internal format of an ICMP header (checksum is missing) */
  86. typedef struct icmp_ {
  87.     char type;
  88.     char code;
  89.      union icmp_args {
  90.         int mtu;
  91.         int unused;
  92.         unsigned char pointer;
  93.         ipaddr address;
  94.         struct {
  95.             int id;
  96.             int seq;
  97.         } echo;
  98.     } args;
  99. } ICMP ;
  100.  
  101. #define    ICMPLEN        8    /* Length of ICMP header on the net */
  102. #define    NULLICMP    (union icmp_args *)0
  103.     
  104. /* Destination Unreachable codes */
  105. #define    ICMP_NET_UNREACH    0    /* Net unreachable */
  106. #define    ICMP_HOST_UNREACH    1    /* Host unreachable */
  107. #define    ICMP_PROT_UNREACH    2    /* Protocol unreachable */
  108. #define    ICMP_PORT_UNREACH    3    /* Port unreachable */
  109. #define    ICMP_FRAG_NEEDED    4    /* Fragmentation needed and DF set */
  110. #define    ICMP_ROUTE_FAIL        5    /* Source route failed */
  111.  
  112. #define    NUNREACH    6
  113.  
  114. /* Time Exceeded codes */
  115. #define    ICMP_TTL_EXCEED        0    /* Time-to-live exceeded */
  116. #define    ICMP_FRAG_EXCEED    1    /* Fragment reassembly time exceeded */
  117.  
  118. #define    NEXCEED        2
  119.  
  120. /* Redirect message codes */
  121. #define    ICMP_REDR_NET    0    /* Redirect for the network */
  122. #define    ICMP_REDR_HOST    1    /* Redirect for the host */
  123. #define    ICMP_REDR_TOS    2    /* Redirect for Type of Service, or-ed with prev */
  124.  
  125. #define    NREDIRECT    3
  126.  
  127. int icmp_output(struct ip_ *,struct mhead *,unsigned ,unsigned ,union icmp_args *);
  128. struct mhead *htonicmp(struct icmp_ *,struct mhead *);
  129. int icmp_input( struct ip_ *, struct mhead * );
  130.